/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.employee.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.employee.entity.StoreBonusSettingCard;

/**
 * 新开卡或卡充值提成设定DAO接口
 * @author liujiang
 * @version 2013-11-13
 */
public interface StoreBonusSettingCardDao extends StoreBonusSettingCardDaoCustom, CrudRepository<StoreBonusSettingCard, Long> {
	@Query("select cs.card_template_id from StoreBonusSettingCard cs where cs.employee.id=?1 and cs.card_template_type=?2")
	public List<Long> getExistTemplateId(Long employeeId, int type);
	@Modifying
	@Query("delete from StoreBonusSettingCard s  where s.employee.id=?1")
	public void deleteByEmployee(Long employeeId);
	
	@Query("from StoreBonusSettingCard cs where cs.store.id=?1 and cs.employee.id=?2 and cs.card_template_type=?3 and cs.card_template_id=?4")
	public List<StoreBonusSettingCard> list(long storeID,long employeeId, int template_type,long templateID);
	
	
}

/**
 * DAO自定义接口
 * @author liujiang
 */
interface StoreBonusSettingCardDaoCustom extends BaseDao<StoreBonusSettingCard> {

}

/**
 * DAO自定义接口实现
 * @author liujiang
 */
@Component
class StoreBonusSettingCardDaoImpl extends BaseDaoImpl<StoreBonusSettingCard> implements StoreBonusSettingCardDaoCustom {

}
